package dao;

import net.sf.cglib.proxy.Enhancer;

public class IntermediaryCglibProxyFactory {
    private static IntermediaryMethodInterceptor callback
            = new IntermediaryMethodInterceptor();

    /**
     * 代理类的实例
     *
     * @param target
     * @param <T>从   54*
     * @return
     */
    public static <T> T create(Class<T> target) {
        Enhancer enhancer = new Enhancer();
        enhancer.setCallback(callback);
        enhancer.setSuperclass(target);
        return (T) enhancer.create();
    }
}
